<!--
 * @Description: 
 * @Author: chenjiaxin
 * @Date: 2022-09-03 21:28:47
 * @LastEditTime: 2022-09-04 15:05:00
 * @FilePath: \vue-ts-vite\src\views\loading\index.vue
-->
<template>
  <div class="Loading">
    <!-- <h1>加载层</h1> -->
    <h3>加载层</h3>
    <p>
      自己写的全局加载层. 通过函数调用打开加载层. 不需要在
      template模板中先渲染出来
    </p>
    <n-button @click="openLoading">打开加载层. 2s关闭</n-button>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import Loading from "@/components/loading/index";

console.log("====loading 组件 加载");

const openLoading = () => {
  const loadingInstance = Loading.open({ title: "参数" });
  setTimeout(() => {
    loadingInstance.close();
  }, 2000);
};

interface IObjectA {
  isShow?: Boolean;
}
interface IObjectB {
  isShow?: Boolean;
}

const testFn = <T = any>(list: T[]) => {
  // return list.filter((ele) => ele?.isShow);
};
</script>

<style scoped lang="less"></style>
